#include <string>
#include <list>
#include "board.hpp"

using namespace std;

class User;
class Table;

class User
{
private:
    bool argCheck(vector<string> &argList, unsigned long int num, bool sendmsg = true);
public:
    int socketfd;
    // Not implemented yet, but it should be in the form:
    //     [username]/[name server]
    string name;
    // Please use the changeTable command to change the table.
    string buffer;
    Table* table;
    int promotion;
    int parse(string line);
};

class Table
{
private:
    // These are used by User::parse();
    void removeUser(User* user);
    void addUser(User* user, bool player = false);
    void startGame();
    void resign(User* user);
    void draw();
    void move(Coord src, Coord dest, User* user);
    void sendall(string message);
public:
    User* white;
    User* black;
    list<User*> userList;
    Board* board;
    bool playing;

    friend int User::parse(string);
};
